/************************************************************************/
/*    Author: Scott Bevin                                               */
/************************************************************************/


#pragma once

#include "../SystemComponent.h"
#include <string>
#include <map>
#include "CEGuiDebuggerTool.h"

namespace XF
{
	class CEGuiDebugVariableTrackerWindow : public CEGuiDebuggerTool
	{
	private:
		const float mWidth, mVerticalSpacing, mHorizontalSpacing, mTextHeight;

		typedef std::vector<std::pair<std::string, std::pair<CEGUI::ButtonBase*, CEGUI::ButtonBase*> > > VariableVec;
		typedef std::vector<std::pair<std::string, std::pair<CEGUI::ButtonBase*, CEGUI::ButtonBase*> > >::iterator VariableVecIt;
		VariableVec mVariables;
		CEGUI::FrameWindow* mDebugWindow;

		void OnVariableRegistered(std::string name);
		void OnVariableChanged(std::string name, std::string value);
		void OnVariableUnregistered(std::string name);

		void RejigWindowHeight();
		void OnInitialize();
		void OnShutDown();

	public:
		CEGuiDebugVariableTrackerWindow();
		~CEGuiDebugVariableTrackerWindow();

		void Show(){mDebugWindow->setVisible(true); mDebugWindow->moveToFront();}
		void Hide(){mDebugWindow->setVisible(false);}
		bool IsVisible(){return mDebugWindow->isVisible();}
	};
}
